package com.example.huichaoliu;

import android.graphics.Color;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.AdapterView.OnItemLongClickListener;
import android.widget.ListView;
import android.widget.TextView;

import com.huichaoliu.adapters.BankSelectAdapter;
import com.huichaoliu.app.R;
import com.rederxu.farmer.BaseActivity;

public class BankSelectActivity extends BaseActivity implements OnClickListener,OnItemClickListener {

	private ListView listView = null;
	private TextView tv_bank = null;
	private TextView tv_credit = null;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		setContentView(R.layout.activity_bank_select);
		super.onCreate(savedInstanceState);
	}
	
	@Override
	public void onClick(View v) {
		switch(v.getId()){
		case R.id.left_button:
			finish();
			break;
		case R.id.tv_bank:
			tv_bank.setBackgroundColor(Color.BLACK);
			tv_credit.setBackgroundColor(Color.TRANSPARENT);
			break;
		case R.id.tv_credit:
			tv_bank.setBackgroundColor(Color.TRANSPARENT);
			tv_credit.setBackgroundColor(Color.BLACK);
			break;
		}
	}

	@Override
	public void init() {
		((TextView) findViewById(R.id.title_text)).setText("选择银行");
		findViewById(R.id.left_button).setOnClickListener(this);
		tv_bank = (TextView) findViewById(R.id.tv_bank);
		tv_credit = (TextView) findViewById(R.id.tv_credit);
		listView = (ListView) findViewById(R.id.listView);
		listView.setOnItemClickListener(this);
		tv_bank.setOnClickListener(this);
		tv_credit.setOnClickListener(this);
	}

	@Override
	public void initData() {
		listView.setAdapter(new BankSelectAdapter(this));
	}

	@Override
	public void onNetworkChanged(boolean isMobNetConnected,
			boolean isWifiConnected) {
		// TODO Auto-generated method stub

	}

	@Override
	public void onItemClick(AdapterView<?> parent, View view, int position,
			long id) {
		startActivity(BankInfoActivity.class);
	}

}
